package cn.wolfcode.trip.base.domain;

import cn.wolfcode.trip.base.util.JSONUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@Setter
@Getter
/**
 * 日报
 */
public class DailyNews extends BaseDomain{

    //状态
    public static final int STATE_NOMAL = 1;//普通
    public static final int STATE_HOT = 2;//推荐

    private String title; //标题

    private String subTitle; //副标题

    private String coverImgUrl;//封面

    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT-8")
    private Date createTime;//创建时间

    private Long userId;//用户id

    private Integer catalog;//分类(美图美文之类的)

    private int state;//状态

    private String authorName;//官方名字

    private NewsContent content;//文章内容

    public String getJson(){
        Map<String,Object> map=new HashMap();
        map.put("id",id);
        map.put("title",title);
        map.put("subTitle",subTitle);
        map.put("coverImgUrl",coverImgUrl);
        map.put("catalog",catalog);
        map.put("state",state);
        return JSONUtil.toJSONString(map);
    }
}